<!--免疫提醒-->
<template>
    <el-card shadow="never" class="aui-card--fill">
        <el-form :inline="true" :model="formInline">
            <el-form-item label="免疫项目">
                <el-input v-model="formInline.project" placeholder="免疫项目" size="small" clearable></el-input>
            </el-form-item>
            <el-form-item label="免疫对象">
                <el-select v-model="formInline.object" placeholder="免疫对象">
                    <el-option v-for="item in object" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit" size="small">查询</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="info" size="small">导出</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="tableData" style="width: 100%" border>
            <el-table-column prop="time" label="到期时间" align="center">
            </el-table-column>
            <el-table-column prop="project" label="免疫项目" align="center">
            </el-table-column>
            <el-table-column prop="object" label="免疫对象" align="center">
            </el-table-column>
            <el-table-column prop="pigsty" label="猪舍" align="center">
            </el-table-column>
            <el-table-column prop="num" label="需免疫数量" align="center">
            </el-table-column>
        </el-table>
        <Pagination @sizeChange="sizeChange" @currentChange="currentChange" :total="total" :currentPage="currentPage"/>
    </el-card>
</template>

<script>
import Pagination from "@/components/pagination.vue";

export default {
    components: {
        Pagination,
    },
    data() {
        return {
            tableData: [
                {
                    time: '2022/2/2',
                    project: '猪瘟',
                    object: '生长猪',
                    pigsty: '1',
                    num: '40',
                }
            ],
            currentPage: 1,//默认显示第一页
            pageSize: 10,//默认每页显示5条数据
            total: 100,//总数据条数
            formInline: {
                project: '',
                object: '',
            },
            object: [
                {
                    value: '生长猪',
                    label: '生长猪'
                }, {
                    value: '种猪',
                    label: '种猪'
                }
            ],
        }
    },
    mounted() {
        // this.getData();
    },
    methods: {
        // 列表的数据接口---------
        getData() {
            this.$http.get(`/mmm`).then(({data: res}) => {
                if (res.code !== 0) {
                    return this.$message.error(res.msg);
                }
                this.tableData = res.data
            }).catch(() => {
            });
        },
        // 每页条数
        sizeChange(val) {
            this.pageSize = val;
        },
        // 当前页
        currentChange(val) {
            this.currentPage = val
        },
        onSubmit() {
            console.log('submit!', this.formInline);
        }
    }
}
</script>
